<script>
export default {
  name: "UsersContent",
  data(){
    return {
      isStartSearch:false,
      isLoading:false,
      items:[]
    }
  },
  mounted() {
    this.$bus.$on('getUserInfosStart',(isStartSearch,isLoading)=>{
      this.isStartSearch = isStartSearch;
      this.isLoading = isLoading;
    });
    this.$bus.$on('getUserInfosEnd',(items,isLoading)=>{
      this.items = items;
      this.isLoading = isLoading;
    });
  }
}
</script>

<template>
  <h3 v-if="!isStartSearch">您还未开始搜索！搜索的结果会在此处进行呈现！</h3>
  <h3 v-else-if="isLoading">正在拼命加载中……</h3>
  <div v-else class="row">
    <div class="card" v-for="item in items" :key="item.id">
      <a href="https://github.com/aa" target="_blank">
        <img :src="item.avatar_url" style="width: 100px;">
      </a>
      <p class="card-text">{{item.login}}</p>
    </div>
  </div>
</template>

<style scoped>
.card {
  float: left;
  width: 33.333%;
  padding: .75rem;
  margin-bottom: 2rem;
  border: 1px solid #efefef;
  text-align: center;
}

.card > img {
  margin-bottom: .75rem;
  border-radius: 100px;
}

.card-text {
  font-size: 85%;
}

</style>
